package com.lhuc.service;

import com.lhuc.bean.Book;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

/**
 * @author lhucstart
 * @create 2021-05-09 17:32
 */
@Service
public class BookService {


    @RabbitListener(queues = "China")
    public void receive(Book book) {
        System.err.println("收到信息：" + book);
    }

    @RabbitListener(queues = "China.news")
    public void receive2(Message message) {
        System.err.println(message.getBody());
        System.err.println(message.getMessageProperties());
    }

}
